rm(list=ls())

library(spatstat)
library(plyr)
library(lattice)

source("set_up.R", encoding = "UTF-8")

# ## Load newly created data from working directory
load('ppm_data_new_afo_r7.RData')

ged.postsurv.r80 <- unmark(ged.postsurv.r80) # after 2018
ged.postsurv.r50 <- unmark(ged.postsurv.r50) # after 2018

log_pop.im <- log(pop.im +1)

r7_r80 <- ppm(ged.postsurv.r80 ~ internet_freq.im + log_pop.im+ light.im  + 
                elev.im + urban.im)


### 40 千米
r7_r50 <- ppm(ged.postsurv.r50 ~  internet_freq.im + log_pop.im+ light.im  + 
                elev.im + urban.im)


save(r7_r50, r7_r80, file = "ppmoutcome_r7.RData")





